CC=gcc
CPP=g++
UNAME := $(shell uname)
CPPFLAGS= -Wall -g -Wno-sign-compare
LDFLAGS= -lSDL2

# OSX uses a different link option
ifeq ($(UNAME),Darwin)
	LDFLAGS += -framework OpenCL
else
	LDFLAGS += -l OpenCL
endif
	
#LDFLAGS= -l OpenCL -lSDL2

OBJ= main.o clerror.o sdl.o opencl.o gradient.o expression.o
BIN=gpubrot

all: $(OBJ) $(BIN)
	
$(BIN): $(OBJ) 
	$(CPP) $(LDFLAGS) $(OBJ) -o $@

.o:
	$(CPP) $(CFLAGS) $< -o $@

clean:
	rm -f $(OBJ) $(BIN)
